package com.doudou.collection.infrastructure.common.web;

import lombok.Getter;

/**
 * className: StatusCode<br>
 * description: 状态码枚举类<br>
 * author: 李浩文<br>
 * date: 2023/6/2 17:15<br>
 * version: 1.0<br>
 */
@Getter
public enum StatusCode {
    SUCCESS(200, "请求成功"),
    FAILED(400, "请求失败"),

    NOT_LOGIN(1000, "未登录"),
    LOGIN_SUCCESS(1001, "登录成功"),
    USERNAME_ERROR(1002, "用户名错误"),
    PASSWORD_ERROR(1003, "密码错误"),
    USERNAME_ALREADY_EXISTS(1004, "用户名已存在"),
    FORBIDDEN_ERROR(1005, "无权访问"),
    CODE_ERROR(1006, "验证码错误"),
    PHONE_ERROR(1007, "手机号码错误"),
    EMAIL_ERROR(1008, "邮箱错误"),
    EMAIL_ALREADY_EXISTS(1009, "邮箱已存在"),
    PHONE_ALREADY_EXISTS(1010, "手机号已存在"),
    SAME_USERNAME(1011, "用户名一致,不需要修改"),
    SAME_PASSWORD(1012, "密码一致,不需要修改"),
    SAME_EMAIL(1013, "邮箱一致,不需要修改"),
    SAME_PHONE(1014, "手机号一致,不需要修改"),

    PHONE_FORMAT_ERROR(2000, "手机号格式错误"),
    EMAIL_FORMAT_ERROR(2001, "邮箱格式错误"),
    USERNAME_FORMAT_ERROR(2002, "用户名格式错误"),
    PASSWORD_FORMAT_ERROR(2003, "密码格式错误"),
    CODE_FORMAT_ERROR(2004, "验证码格式错误"),

    URL_PARAMETER_ERROR(4000, "路径参数错误"),
    INVALID_TOKEN(4010, "token异常"),

    ERROR_UNAUTHORIZED(40100),
    ERROR_INSERT(50000),
    ERROR_UPDATE(50200),
    ERROR_UNKNOWN(99999, "服务器忙，请稍后再试！")
    ;


    /**
     * 状态码
     */
    private int code;
    /**
     * 状态码信息
     */
    private String message;

    StatusCode(int code) {
        this.code = code;
    }

    StatusCode(int code, String message) {
        this(code);
        this.message = message;
    }
}
